package com.paw.antd.controller;

import cn.hutool.core.util.RandomUtil;
import cn.hutool.json.JSONUtil;
import com.paw.antd.domain.Result;
import com.paw.antd.request.dto.DeliverBoxRequestDto;
import com.paw.antd.response.dto.DeliverBoxResponseDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lvzihai
 * @date 2021/8/14
 **/
@Slf4j
@Api(value = "DeliverController",tags = "deliverApi")
@RestController
public class DeliverController {

  @ApiOperation("邮寄包裹")
  @PostMapping("/api/skye/deliver/box")
  public Result<DeliverBoxResponseDto> deliverBox(@RequestBody DeliverBoxRequestDto requestDto){
    log.info("deliver "+ JSONUtil.toJsonStr(requestDto));
    DeliverBoxResponseDto dto = new DeliverBoxResponseDto();
    dto.setDeliver(RandomUtil.randomString(6));
    dto.setDeliverPhone(RandomUtil.randomNumbers(11));
    dto.setSign("signed");
    return Result.success(dto);
  }
}
